import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { SocialSharing } from '@ionic-native/social-sharing';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  constructor(
    public navCtrl: NavController,
    public SocialSharing: SocialSharing
  ) {

  }
  share(message, subject?, file?, url?) {
    this.SocialSharing.share(message, subject, file, url).then(() => {

    }, (err) => {
      // Error!  
      alert('错误：分享失败！' + err);
    });
  }
  a() {
    this.SocialSharing.shareViaEmail('Body', 'Subject', ['10255630050@qq.com']).then(() => {
      // Success!
    }).catch(() => {
      // Error!
    });
  }
  b() {
    this.SocialSharing.canShareVia('惠民易贷','惠民益贷专注20年', 'Subject', 'https://ss0.baidu.com/73F1bjeh1BF3odCf/it/u=1639896507,3292760166&fm=85&s=06F0C0323C3267941E839AAB0300B02D','http://wwww.baidu.com').then(() => {
      // Success!
    }).catch(() => {
      // Error!
    });
  }
  c(){
    this.SocialSharing.shareViaTwitter('惠民易贷专注20年','https://ss0.baidu.com/73F1bjeh1BF3odCf/it/u=1639896507,3292760166&fm=85&s=06F0C0323C3267941E839AAB0300B02D','http://wwww.baidu.com')
  }
  d(){
    this.SocialSharing.shareViaFacebook('惠民易贷专注20年','https://ss0.baidu.com/73F1bjeh1BF3odCf/it/u=1639896507,3292760166&fm=85&s=06F0C0323C3267941E839AAB0300B02D','http://wwww.baidu.com')
  }
  e(){
    this.SocialSharing.shareViaFacebookWithPasteMessageHint('惠民易贷专注20年','https://ss0.baidu.com/73F1bjeh1BF3odCf/it/u=1639896507,3292760166&fm=85&s=06F0C0323C3267941E839AAB0300B02D','http://wwww.baidu.com',null)
  }
}
